#include "EvolutionaryException.hpp"
#include <sstream>

EvolutionaryException::EvolutionaryException(const char* message):
  _line(0),_file(""),_function(""),_code(0)
{
  _message=message;
  _file=_function="unknown";
}

EvolutionaryException::EvolutionaryException(const int& code,const char* message,
				     const char* function,const char *file,
				     const int& line):_message(message),
						      _line(line),
						      _file(file),
						      _function(function),
						      _code(code)
{
 
}

EvolutionaryException::EvolutionaryException(const EvolutionaryException 
					     &exception)
{
  _message=exception._message;
  _line=exception._line;
  _file=exception._file;
  _function=exception._function;
  _code=exception._code;
}


EvolutionaryException &EvolutionaryException::operator=
(const EvolutionaryException &exception)
{
  _message=exception._message;
  _line=exception._line;
  _file=exception._file;
  _function=exception._function;
  _code=exception._code;
  return *this;
}



const char * EvolutionaryException::what() const throw()
{
  std::stringstream buff;
  buff<<_file<<": "<<_function<<": "<<_line<<": "<<_code<<" "<<_message
      <<std::endl;
  std::string info=buff.str();
  
  return info.c_str();
}

EvolutionaryException::~EvolutionaryException() throw()
{
}
